package com.tuzhi.filestore.mq.consume;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 功能说明：
 *
 * @author abu
 * @version 1.1.0
 * @date 2023/2/20
 */
 @Component
@Slf4j
public class QueueListener {

    //Constant.queueName = "fileStoreProcessorMsgQueue"

    @RabbitListener(queues = "fileStoreProcessorMsgQueue")
    public void receiveMsg(Message msg) throws Exception {

         try {
             String message = new String(msg.getBody(),"gbk");
             log.info("hole接收消息：{}", message);
            // JSON json = JSONUtil.parse(message);
             //String msga = json.getByPath("msg").toString();
             //MqMsg mqMsg = JSONUtil.toBean(holeData,MqMsg.class);
             // log.warn("msg:{}",msga);
             // log.info(msg.getMessageProperties().toString());
             //TODO 这里调用webStocke 通知到前端
        } catch (Exception e) {
             e.printStackTrace();
            log.error("接受信息处理失败:", ExceptionUtils.getRootCauseStackTrace(e));

        }
    }




}
